#pragma once
#include <vector>
#ifndef UI_WNDSTYLE_TOOLTOP_DIALOG
#define UI_WNDSTYLE_TOOLTOP_DIALOG     (  WS_CLIPCHILDREN | WS_CLIPSIBLINGS )
typedef CWinTraits<UI_WNDSTYLE_TOOLTOP_DIALOG\
, WS_EX_TOPMOST | WS_EX_TOOLWINDOW >		CToolTipTraits;
#endif

namespace UILib
{
    enum
    {
        timerShow			= 100,								// Show timer
        timerHide			= 101								// Hide timer
    };
    class CDrawToolTip : public CWindowImpl<CDrawToolTip, CWindow, CToolTipTraits>
    {
    public:
        CDrawToolTip(const UINT uID = -1);
        virtual ~CDrawToolTip(void);

        virtual UINT GetID() const{ return m_uID; };

        BOOL CreateTips( const HWND hWnd = NULL );
        void SetDelayTime(const int nDlay = 200){ m_nDlayTime = nDlay; };

        void ShowTips( const wstring& wszTips, const POINT& pt);
        void HideTips();

        void RelayEvent( LPMSG lpMsg );

        DECLARE_WND_CLASS(L"HiClub_ToolTips")
        virtual BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0);
    protected:
        virtual LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnNcDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnEraseBkgnd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnMouseLeave(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnLbuttonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnLbuttonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnSetFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
        virtual LRESULT OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);

        virtual void Render(const PAINTSTRUCT &ps);
        virtual void CreateElement();
        virtual void FreeElement();
        BOOL GetWindowSize(HDC hDC, SIZE& szWnd);
    protected:
        BOOL        m_bTracking;
        UINT        m_uID;
        wstring     m_wszTipText;
        int         m_nDlayTime;
        POINT       m_ptOrg;
        UINT        uTimerShow_;
        UINT        uTimerHide_;
        LOGFONT     lfText_;
    };
}
